import {genFormOptions} from "vijay-util";
import {AREA_LIST} from "@/config/area";

export const Formatter = {
    addrFmt({city, province, area} = {} as any) {
        let p = AREA_LIST.province_list[province],
            c = AREA_LIST.city_list[city],
            a = AREA_LIST.county_list[area];
        return [p, c, a].filter(Boolean).join("/")
    },
    addrFmtCode(data = {} as any) {
        const {cityCode, provinceCode, areaCode} = data
        let p = AREA_LIST.province_list[provinceCode],
            c = AREA_LIST.city_list[cityCode],
            a = AREA_LIST.county_list[areaCode];
        return [p, c, a].filter(Boolean).join("/")
    }
}
export const PROFILE_FM = [
    {name: "realname", label: "姓名"},
    {name: "companyName", label: "公司"},
    {name: "profession", label: "职位"},
    {name: "phone", label: "手机号", cfg: {type: "tel"}},
    {name: "email", label: "邮箱"},
];
export const JOB_FM = [
    {name: "x", label: "姓名"},
    {name: "x", label: "手机号"},
    {name: "x", label: "邮箱"},
    {name: "qqx", label: "性别", type: "radio", cfg: genFormOptions(["男", "女"])},
    {name: "x", label: "公司"},
    {name: "x", label: "公司"},
    {name: "x", label: "职位"},
    {name: "x", label: "邮箱"},
];
export const RESUME_FM = [
    {name: "name", label: "姓名："},
    {name: "sex", label: "性别：", type: "radio", cfg: genFormOptions(["男", "女"], 1)},
    {name: "birthday", label: "出生年月：", type: "select", cmp: "date"},
    {name: "address", label: "户籍所在地："},
    {name: "living", label: "现居地："},
    {name: "politica", label: "政治面貌："},
    {
        name: "educational", label: "学历：", type: "select",
        cfg: genFormOptions(["小学", "初中", "高中", "大专", "本科", "研究生", "其他"], 1),
        formatter: ({educational}) => ["小学", "初中", "高中", "大专", "本科", "研究生", "其他"][educational - 1]
    },
    {name: "graduate", label: "毕业院校："},
    {name: "specialty", label: "专业："},
    {name: "graduation", label: "毕业时间：", type: "select", cmp: "date"},
    {name: "record", label: "工作履历：", cfg: {type: "textarea", 'show-word-limit': true, maxlength: 50}},
    {name: "about", label: "自我介绍：", cfg: {type: "textarea", 'show-word-limit': true, maxlength: 50}},
];
export const PROFILE_FM_SUB = [
    {
        names: ["provinceCode", "cityCode", "areaCode"],
        label: "城市",
        type: "select",
        cmp: "area",
        formatter: Formatter.addrFmtCode
    },
    {name: "businessAddress", label: "办公地点"},
    {name: "incubator", label: "入驻孵化器"},
    {name: "college", label: "高校创业学院"},
    {name: "profile", label: "个人简介", cfg: {type: "textarea", 'show-word-limit': true, maxlength: 50}},
    {
        name: "entrepreneur",
        label: "创业阶段",
        type: "select",
        cfg: genFormOptions(["种子", "天使", "Pre-A", "A轮", "A轮以上6尚未融资"], 1),
        formatter: ({entrepreneur}) => ["种子", "天使", "Pre-A", "A轮", "A轮以上6尚未融资"][entrepreneur - 1]
    },
];
